$(document).ready(function() { 	
	
$(".like").click(function()
{
	
var id=$(this).attr("id");
var name=$(this).attr("name");
var dataString = 'eventid='+ id + '&name='+ name;
$("#votebox").slideDown("slow");

$.ajax
({
type: "GET",
url: "api/events/like",
data: dataString,
cache: false,
success: function(html)
{

var lid=$(this).attr("id");
//console.log(this.type);
//console.log(id);
$("#likes_area_"+id).html(html);
$("#rating_"+id).fadeOut("fast");
}
});

});   

$(".comment").click(function()
{

	var id=$(this).attr("id");
	var dataString = 'eventid='+ id;

	$.ajax
	({
	type: "GET",
	url: "api/comments/"+id,
	cache: false,
	success: function(data)
	{
	var lid=$(this).attr("id");
//	console.log(this.type);
//	console.log(id);
	
	$("#commentsarea_"+id).html("<ul class='comments'>");

    $.each(data, function(i, item) {
        $("#commentsarea_"+id).append("<li class=\"comment\"> <p>" + item.comment +"</p></li>");
    });

    $("#commentsarea_"+id).append("</ul>");
	
    
	$("#show_comments_"+id).fadeOut("fast");
	}
	});	
	
	
	
	
});   


});  